package ptaweek1;

import java.util.Scanner;

public class topic02{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		   int sum=0,a,b,i;
		   int t[]=new int[100];
		   
		  while(true){
		   
			  String str=sc.nextLine();
			  a=Integer.parseInt(str);   
		   if(a>=10000&&a<=20000)
			System.out.println(Integer.toBinaryString(a)+","+Integer.toOctalString(a)+","+Integer.toHexString(a));
		   else
		   {
			if(a<0)
				a=-a;
			int num=a;
			for(i=0;a/10!=0;i++){
				b=a%10;
				t[i]=b;
				a=a/10;	
			}
			b=a%10;
			System.out.print(b+" ");
			i--;
			for(;i>=0;i--){
				System.out.print(t[i]+" ");
			}
			while(num!=0){
				sum=sum+num%10;
				num=num/10;
			}
			System.out.println(sum);
			}
		sum=0;
		
			
}

}

}
